package com.ctcemti.mdm.common.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionTemplate;

@Component
public class TransactionTemplateUtils implements ApplicationContextAware {

	/** 事务模板 */
	@Autowired
    private static TransactionTemplate transactionTemplate; // set方法


    public static TransactionTemplate getTransactionTemplate() {
        return transactionTemplate;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.transactionTemplate = (TransactionTemplate) applicationContext.getBean("transactionTemplate");
    }


}
